package com.hbk.base.conf;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

@Configuration
public class ErrorPageConfig {

    @Bean
    public ErrorPageRegistrar containerCustomizer(){
        return registry -> {
            registry.addErrorPages(
                    new ErrorPage(HttpStatus.BAD_REQUEST, "/400"),
                    new ErrorPage(HttpStatus.UNAUTHORIZED, "/401"),
                    new ErrorPage(HttpStatus.PAYMENT_REQUIRED, "/402"),
                    new ErrorPage(HttpStatus.FORBIDDEN, "/403"),
                    new ErrorPage(HttpStatus.NOT_FOUND, "/404")
                    );
        };
    }
}
